package com.mowwang.file;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class Reader {
    public static void main(String[] args) {
        FileReader fileReader=null;
        try {
           fileReader =new FileReader(new File("a.txt"));
//           int mun=fileReader.read();
//            System.out.println((char) mun);
//            mun=fileReader.read();
//            System.out.println((char)mun);
            int mun=0;
            //文本读取完毕，最后读到没有字符时返回-1
            while ((mun=fileReader.read())!=-1){
                System.out.print((char) mun);
            }

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            try {
                fileReader.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
